<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}finnbogi.css" />
    <title>{{ title }}</title>
</head>

<body>

<div id="wrap">
    <h1 id="title">{{ title }}</h1>

    {% if exams_list %}
        <ul>
            {% for exam in exams_list %}
                
                <li>
                    {%  for key,value in exam_open.items %}
                        {% ifequal exam.id key %}
                            {% if value  %}
                                <a href="/exams/{{ exam.id }}/{{ user.id }}">{{ exam.remarks }}</a>
                                <p>Open until : {{ exam.pub_date|date:"d M Y" }}</p>
                            {% else %}
                                <p>{{ exam.remarks }}</p>
                                <p>This exam is closed!</p>
                            {% endif %}
                        {% endifequal %}
                    {% endfor %}
                </li>
            {% endfor %}
        </ul>
    {% else %}
        <p>No exams are available.</p>
    {% endif %}

    {% if user.role_id == 1 %}
        <a href="/exams/create/">Create new exam</a>
    {% else %}
        <a href="/exams/user/{{ user.id }}">My exams</a>
    {% endif %}
</div>

</body>
</html>